package com.cci.kangdao.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;
import java.util.Map;


@MapperScan
public interface UserHasRolesTDao {


    //根据服务站id  作废该服务站下所有人员的角色
    @Update("update UserHasRoles_T set Flag = -1 where UserID in (select ID from User_T where Flag = 0 and ServiceStationID = #{serviceStationID}) and Flag = 0")
    int deleteUserHasRolesTByUserId(@Param("serviceStationID") long serviceStationID);

    @Insert("insert into UserHasRoles_T(UserID,RolesID,Flag,Systime) \n" +
            "(select ID,2,0,sysdatetimeoffset() from User_T where Flag = 0 and ServiceStationID = #{serviceStationID})")
    int insertUserHasRolesTByUserId(@Param("serviceStationID") long serviceStationID);
}
